/* 816. 模糊坐标  */
/**
 * @param {string} s
 * @return {string[]}
 */
var ambiguousCoordinates = function (s) {
	const n = s.length - 2
	const res = []
	s = s.slice(1, s.length - 1)
	for (let l = 1; l < n; l++) {
		// 左边的字符
		const lt = getPos(s.slice(0, l))
		if (!lt.length) continue
		const rt = getPos(s.slice(l))
		if (!rt.length) continue
		for (const i of lt) {
			for (const j of rt) {
				res.push('(' + i + ', ' + j + ')')
			}
		}
	}
	return res
}

const getPos = (s) => {
	const pos = []
	// 排除 00
	if (s[0] !== '0' || s === '0') {
		pos.push(s)
	}
	for (let p = 1; p < s.length; p++) {
		// 排除 1.0
		if ((p !== 1 && s[0] === '0') || s[s.length - 1] === '0') {
			continue
		}
		pos.push(s.slice(0, p) + '.' + s.slice(p))
	}
	return pos
}
ambiguousCoordinates('(00011)')
